package com.example.light.system.controller;

import com.example.light.system.common.Result;
import com.example.light.system.dto.permissionTree;
import com.example.light.system.service.impl.IPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;

@Api(description = "权限管理接口")
@RestController
@RequestMapping("/PermissionController")
public class PermissionController {
    @Resource
    IPermissionService iPermissionService;

    @ApiOperation("查询所有权限信息")
    @PostMapping("/searchAllPermission")
    public Result<ArrayList<permissionTree>> searchAllPermission(){
        return iPermissionService.searchAllPermission();
    }

    @ApiOperation("查询角色权限信息")
    @PostMapping("/searchRolePermission")
    public Result<ArrayList<Integer>> searchRolePermission(Integer roleId){
        return iPermissionService.searchRolePermission(roleId);
    }
}
